unit unit_SettingsConsts;
interface
type
  TParamType = (ptUnknown, ptInteger, ptBoolean, ptAnsiString);
  TParamRecord = record
    SectionName: AnsiString;
    ParamName: AnsiString;
    ParamType: TParamType;
    Default: AnsiString;
  end;
const  //INI-file section variables
  //
  // Ini sections names
  //
  SECTION_GENERAL_SETTINGS = 'GeneralSettings';
  SECTION_GENESIS_FILELIST = 'GenesisFilelist';
  SECTION_LOG_FILES = 'LogFiles';
  SECTION_LOCAL_REPOSITORY = 'LocalRepository';
  SECTION_EXTRA_REPOSITORY = 'ExtraRepository';
  SECTION_OUTDATED_REPOSITORY = 'OutdatedRepository';
  SECTION_WEB_REPOSITORY = 'WebRepository';
  SECTION_CHECK_OPTIONS = 'CheckOptions';
  SECTION_GENESIS_DB = 'GenesisDBOptions';
  //
  // Parameters names in section ARC_PATHS and they default values
  //
  T_DIR: TParamRecord =
    (SectionName: SECTION_GENERAL_SETTINGS; ParamName: 'TempDirectory';
      ParamType: ptAnsiString; Default: '{APPDIR}\$tmp');
  //
  TEMP_DIR = 'TempDirectory';
  TEMP_DIR_DEF = '{APPDIR}\$tmp\';
  CONVERT_PATHES_TO_RELATIVE = 'ConvertPathesToRelative';
  CONVERT_PATHES_TO_RELATIVE_DEF = True;
  RELATIVE_CONVERSION_LEVEL = 'RelativeConversionLevel';
  RELATIVE_CONVERSION_LEVEL_DEF = 0;
  AUTOLOAD_LOCAL_DB_DUMP = 'AutoLoadLocalDBDump';
  AUTOLOAD_LOCAL_DB_DUMP_DEF = False;
  AUTOSAVE_LOCAL_DB_DUMP = 'AutoSaveLocalDBDump';
  AUTOSAVE_LOCAL_DB_DUMP_DEF = False;
  //
  // Parameters names in section LOCAL_REPOSITORY and they default values
  //
  REPOSITORIES_COUNT = 'RepositoriesCount';
  REPOSITORIES_COUNT_DEF = 0;
  REPOSITORY_PATH_TEMPLATE = 'Repository_Dir_';
  REPOSITORY_PATH_DEF = 'D:\Genesis\Repository\';
  REPOSITORY_MIN_ID_TEMPLATE = 'Repository_MinID_';
  REPOSITORY_MIN_ID_DEF = 0;
  REPOSITORY_MAX_ID_TEMPLATE = 'Repository_MaxID_';
  REPOSITORY_MAX_ID_DEF = 0;
  //
  // Parameters names in section EXTRA_REPOSITORY and they default values
  //

  //
  // Parameters names in section OUTDATED_REPOSITORY and they default values
  //

  //
  // Parameters names in section WEB_REPOSITORY and they default values
  //
  SERVERS_COUNT = 'ServersCount';
  SERVERS_COUNT_DEF = 0;
  SERVER_TEMPLATE_URL = 'TemplateURL_Server_';
  SERVER_TEMPLATE_URL_DEF = 'http://gen.lib.rus.ec/get?md5={MD5}';
  SERVER_MIN_ID_TEMPLATE = 'Server_MinID_';
  SERVER_MIN_ID_DEF = 1;
  SERVER_MAX_ID_TEMPLATE = 'Server_MaxID_';
  SERVER_MAX_ID_DEF = 275999;
  //
  // Common repositories section parameters
  //
  REPOSITORY_ROOT = 'RepositoryRoot';
  REPOSITORY_ROOT_DEF = '';

  //
  // Parameters names in section CHECK_OPTIONS and they default values
  //
  PROCESS_LOCAL_FILES = 'ProcessLocalFiles';
  PROCESS_LOCAL_FILES_DEF = True;
  PROCESS_EXTRA_FILES = 'ProcessExtraFiles';
  PROCESS_EXTRA_FILES_DEF = False;
  // Check range settings
  OPTION_CHECK_START_ID = 'CheckStartID';
  OPTION_CHECK_START_ID_DEF = 0;
  OPTION_CHECK_FINISH_ID = 'CheckFinishID';
  OPTION_CHECK_FINISH_ID_DEF = 0;
  // Optional file's checks
  OPTION_LOCAL_FILES_CHECKS = 'LocalFilesChecks';
  OPTION_LOCAL_FILES_CHECKS_DEF = 0;
  OPTION_EXTRA_FILES_CHECKS = 'ExtraFilesChecks';
  OPTION_EXTRA_FILES_CHECKS_DEF = 0;
  //
  OPTION_CHECK_FILESIZE = 'CheckFileSize';
  OPTION_CHECK_FILESIZE_DEF = True;
  OPTION_CHECK_MD5 = 'CheckMD5';
  OPTION_CHECK_MD5_DEF = False;
  //
  OPTION_CREATE_MISSED_FILES_URL = 'CreateUrlForMissedFiles';
  OPTION_CREATE_MISSED_FILES_URL_DEF = True;
  //
  // Parameters names in section GENESIS_FILELIST and they default values
  //
  GENESIS_FILELIST_NAME = 'GenesisFileListName';
  GENESIS_FILELIST_NAME_DEF = 'in\gen_list.csv';
  GENESIS_FIELD_DELIMITER = 'GenesisFileDelimiter';
  GENESIS_FIELD_DELIMITER_DEF = ',';
  GENESIS_FILEPATH_DELIMITER = 'GenesisFilePathDelimiter';
  GENESIS_FILEPATH_DELIMITER_DEF = '/';
  GENESIS_LOCAL_DB_DUMP_FILENAME = 'LocalDBDump';
  GENESIS_LOCAL_DB_DUMP_FILENAME_DEF = 'dbdump.dat';
  //
  // Parameters names in section LOG_FILES and they default values
  //
  LOG_FILE_ERROR_FILESIZE = 'LogFile_Error_FileSize';
  LOG_FILE_ERROR_FILESIZE_DEF = 'res\ERROR_filesize.log';
  LOG_CREATE_ERROR_FILESIZE = 'CreateLog_Error_FileSize';
  LOG_CREATE_ERROR_FILESIZE_DEF = True;
  //
  LOG_FILE_ERROR_MD5 = 'LogFile_Error_MD5';
  LOG_FILE_ERROR_MD5_DEF = 'res\ERROR_md5.log';
  LOG_CREATE_ERROR_MD5 = 'CreateLog_Error_MD5';
  LOG_CREATE_ERROR_MD5_DEF = True;
  //
  LOG_FILE_EXTRA_FILES = 'LogFile_ExtraFiles';
  LOG_FILE_EXTRA_FILES_DEF = 'res\extra_files.log';
  LOG_CREATE_EXTRA_FILES = 'CreateLog_ExtraFiles';
  LOG_CREATE_EXTRA_FILES_DEF = False;
  //
  LOG_FILE_MISSED_FILES_URLLIST = 'LogFile_MissedFilesUrl';
  LOG_FILE_MISSED_FILES_URLLIST_DEF = 'res\missed_files_URL.log';
  LOG_CREATE_MISSED_FILES_URLLIST = 'CreateLog_MissedFilesURL';
  LOG_CREATE_MISSED_FILES_URLLIST_DEF = True;
  //
  LOG_FILE_MISSED_FILES = 'LogFile_MissedFiles';
  LOG_FILE_MISSED_FILES_DEF = 'res\missed_files.log';
  LOG_CREATE_MISSED_FILES = 'CreateLog_MissedFiles';
  LOG_CREATE_MISSED_FILES_DEF = True;
  //
  LOG_FILE_EXIST_FILES = 'LogFile_ExistFiles';
  LOG_FILE_EXIST_FILES_DEF = 'res\exist_files.log';
  LOG_CREATE_EXIST_FILES = 'CreateLog_ExistFiles';
  LOG_CREATE_EXIST_FILES_DEF = False;
  //
  //
  LOG_FILE_OUTDATED_FILES = 'LogFile_OutdatedFiles';
  LOG_FILE_OUTDATED_FILES_DEF = 'res\outdated_files.log';
  LOG_CREATE_OUTDATED_FILES = 'CreateLog_OutdatedFiles';
  LOG_CREATE_OUTDATED_FILES_DEF = False;
  //
  LOG_FILE_ERROR_ID = 'LogFile_ErrorID';
  LOG_FILE_ERROR_ID_DEF = 'res\error_id.log';
  LOG_CREATE_ERROR_ID = 'CreateLog_ErrorID';
  LOG_CREATE_ERROR_ID_DEF = True;
const
  //
  // Template related variables
  //
  REPOSITORY_SUBDIR_TEMPLATE = '{REPOSITORY_SUB_DIR}';
  MD5_TEMPLATE = '{MD5}';
  REL_PATH_TEMPLATE: array [0..9] of AnsiString = ('{APPDIR}', '{APPDIR-1}',
    '{APPDIR-2}', '{APPDIR-3}', '{APPDIR-4}', '{APPDIR-5}', '{APPDIR-6}',
    '{APPDIR-7}', '{APPDIR-8}', '{APPDIR-9}');
    

  //
  // String constants
  //
  EOLN = #13+#10;
  TAB_DELIMITER = #9;
  TAB_DELIMITER_STRING = 'TAB';

const
  //
  // CSV File structure related constants
  //
  GEN_FIELD_COUNT = 4;
  GEN_ID_FIELD_INDEX = 0;
  GEN_FILENAME_FIELD_INDEX = 1;
  GEN_FILESIZE_FIELD_INDEX = 2;
  GEN_MD5_FIELD_INDEX = 3;
  //
  // Log files constants
  //
  ABS_PATH_COLON_POS = 2;
  ABS_PATH_COLON = ':';

implementation

end.
